<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    
</head>
<body>
    <div id="app">
        <input type="button" value="飞" @click="lang">
        <input type="button" value="停" @click="stop">
       <div>{{mas}}</div>
    </div>
</body>
<script src="./js/vue-2.4.0.js"></script>
<script>
   var vue = new Vue({
       el:'#app',
       data:{
           mas:'浪起来吧哒哒哒~~',
           setIntervalid: null,
       },
       methods:{
        //    开启定时器
        lang(){
        if(this.setIntervalid != null)return;
           this.setIntervalid = setInterval(()=> {
           var one = this.mas.substring(0,1)
           var text = this.mas.substring(1)
            this.mas =text+one
            },400)
           
        },
         // 停止定时器 
       stop(){
           clearInterval(this.setIntervalid)
           this.setIntervalid = null;
           console.log(1)
           console.log(1)
       }
       }
      
   })
</script>
</html>